﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Ceremony.API.Model
{
    /// <summary>
    /// 评论
    /// </summary>
    public class Comment
    {
        public int Id { get; set; }
        /// <summary>
        /// 发布的朋友圈Id
        /// </summary>
        public int WechatMomentId { get; set; }
        /// <summary>
        /// 回复类型(0:点赞,1:评论,2:回复)
        /// </summary>
        public int CommentType { get; set; }
        /// <summary>
        /// 来自的用户Id
        /// </summary>
        public int FromUserId { get; set; }
        /// <summary>
        /// 需要发送给的用户Id
        /// </summary>
        public int ToUserId { get; set; }
        /// <summary>
        /// 评论的消息
        /// </summary>
        public string CommentMessage { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsRemove { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        public DateTime? RemoveTime { get; set; }

        private Comment() { }

        public Comment(int wechatMomentId, int commentType,int fromUserId,
            int toUserId,string commentMessage)
        {
            this.WechatMomentId = wechatMomentId;
            this.CommentType = commentType;
            this.FromUserId = fromUserId;
            this.ToUserId = toUserId;
            this.IsRemove = false;
            this.CommentMessage = commentMessage;
            this.CreateTime = DateTime.Now;
        }

        public void Remove()
        {
            this.IsRemove = true;
            this.RemoveTime = DateTime.Now;
        }
    }
}
